package com.dididoctor.doctor.Activity.PatientDetial;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.dididoctor.doctor.MV.adapter.CommonAdapter;
import com.dididoctor.doctor.MV.adapter.ViewHolder;
import com.dididoctor.doctor.R;

import java.util.List;

/**
 * @version 2.0
 * @类描述：
 * @项目名称：ddgh
 * @类名称： OrderAdapter
 * @包名称： com.dididoctor.doctor.Activity.Order
 * @创建人： zhanjunjie
 * @创建时间：2016/4/20 18:43
 * @修改人：
 * @修改时间：2016/4/20 18:43
 * @修改备注： new parent class(用一句话描述修改了什么)
 */
public class CaseHistoryAdapter extends CommonAdapter<CaseHistoryBean> {

    private TextView mTvHospital,mTvDate,mTvDoctorname,mTvJibing;
    private List<CaseHistoryBean> datas;
    private TextView mTvLookDetail;

    public CaseHistoryAdapter(Context context, List<CaseHistoryBean> datas) {
        super(context, datas, R.layout.item_case);
        this.context = context;
        this.datas = datas;
    }

    @Override
    public void convert(int position, ViewHolder helper, final CaseHistoryBean item) {
        //就诊医院
        mTvHospital = helper.getView(R.id.tv_hospital);
        mTvHospital.setText(item.getHosName());
        //就诊日期
        mTvDate = helper.getView(R.id.tv_date);
        mTvDate.setText(item.getClinicDate());
        //主治医师
        mTvDoctorname = helper.getView(R.id.tv_doctorname);
        mTvDoctorname.setText(item.getDctName());
        //主诉
        mTvJibing = helper.getView(R.id.tv_jibing);
        mTvJibing.setText(item.getDescr());

        mTvLookDetail = helper.getView(R.id.tv_look_detail);
        helper.getConvertView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(context, CaseHistoryDetialActivity.class);
                intent.putExtra("recId", item.getRecId());
                intent.putExtra("type", item.getType());
                context.startActivity(intent);
            }
        });
    }
}
